var multer = require('multer');

var options = multer.diskStorage({
	//设置文件存放路径
	destination : function (req, file , cb) {
		cb(null, './public/uploads');
	},
	
	//设置默认文件名
	filename : function (req, file , cb) {
		var fileFormat = file.originalname.split('.');
		cb(null, file.fieldname + '-' + Date.now() + '.' + fileFormat[fileFormat.length - 1]);
	}
})

var multerUtil = multer({
	storage : options
});

module.exports = multerUtil;
